package net.url;

import java.net.URL;

public class URLSplliter
{
	public static void main(String[] args)
	{
		for (int i = 0; i < args.length; i++)
		{
			try
			{
				URL u = new URL(args[i]);
				System.out.println("the url is" + u);
				System.out.println("the shcheme is "+ u.getProtocol());
				System.out.println("the user info is"+u.getUserInfo());
				String host = u.getHost();
				if(host!=null)
				{
					int stSign = host.indexOf('@');
					if(stSign!=-1)
					{
						host = host.substring(stSign+1);
					}
					System.out.println("the host is"+host);
				}else
				{
					System.out.println("the host is null");
				}
				System.out.println("the port is"+u.getPort());
				System.out.println("the path is"+u.getPath());
				System.out.println("the ref is"+u.getRef());
				System.out.println("the query string is"+u.getQuery());
			}
			catch (Exception e)
			{
			}
		}
	}
}
